/* Ejercicio 3.21
   ejer3_21.c */
#include <stdio.h>

/* funcion main, el programa inicia aca */
int main( void )
{
    int hours;
    float rate, salary;

    printf( "Enter # of hours worked (-1 to end): " );
    scanf( "%d", &hours );
    while( hours != -1 ) {
        printf( "Enter hourly rate of the worker ($00.00): " );
        scanf( "%f", &rate );

        if ( hours <= 40 ) {
            salary = hours * rate;
        } else {
            salary = 40 * rate + 1.5 * ( hours - 40 ) * rate;
        }

        printf ( "Salary is $%.2f\n\n", salary );
        printf( "Enter # of hours worked (-1 to end): " );
        scanf( "%d", &hours );
    }
	return 0;
} /* fin de la funcion main */
